<template>
	<view>
		<view class="body">
			<nest-jumping-spectrum :sWidth="500" :spectrumHeightMax="100" ref="jumpingSpectrum"></nest-jumping-spectrum>
		</view>
		<view class="btns">
			<button class="btn1" @click="startJumping" type="primary">开始</button>
			<button class="btn2" @click="stopJumping" type="warn">结束</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {

			}
		},
		methods: {
			startJumping() {
				// 通过 this.$refs 获取组件实例并调用组件的方法
				this.$refs.jumpingSpectrum.startJumping();
			},
			stopJumping() {
				this.$refs.jumpingSpectrum.stopJumping();
			},
		}
	}
</script>

<style>
	.body {
		height: 200rpx;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.btns {
		display: flex;
		align-items: center;
		padding: 30rpx;
	}

	.btn1 {
		flex: 1;
		margin-right: 15rpx;
	}

	.btn2 {
		flex: 1;
		margin-left: 15rpx;
	}
</style>